home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / dflat2.zip / BUTTON.C < prev    next >
Text File  |  1991-04-12  |  1KB  |  47 lines

  1. /* -------------- button.c -------------- */
  2.  
  3. #include <conio.h>
  4. #include "dflat.h"
  5.  
  6. int ButtonProc(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
  7. {
  8.     int rtn, i;
  9.     switch (msg)    {
  10.         case SETFOCUS:
  11.             BaseWndProc(BUTTON, wnd, msg, p1, p2);
  12.             if (p1)
  13.                 return TRUE;
  14.         case PAINT:
  15.             if (isVisible(wnd))    {
  16.                 /* -------- draw the button's shadow ------- */
  17.                 background = WndBackground(GetParent(wnd));
  18.                 foreground = BLACK;
  19.                 PutWindowChar(wnd, WindowWidth(wnd), 0, 220);
  20.                 for (i = 0; i < WindowWidth(wnd); i++)
  21.                     PutWindowChar(wnd, i+1, 1, 223);
  22.                 /* --------- write the button's text ------- */
  23.                 WriteTextLine(wnd, NULL, 0, wnd == inFocus);
  24.             }
  25.             return TRUE;
  26.         case KEYBOARD:
  27.             if (p1 == '\r')    {
  28.                 PostMessage(GetParent(wnd), COMMAND,
  29.                     ((CTLWINDOW *)(wnd->extension))->command, 0);
  30.                 return TRUE;
  31.             }
  32.             break;
  33.         case LEFT_BUTTON:
  34.             rtn = BaseWndProc(BUTTON, wnd, msg, p1, p2);
  35.             PostMessage(GetParent(wnd), COMMAND,
  36.                 ((CTLWINDOW *)(wnd->extension))->command, 0);
  37.             return rtn;
  38.         case HORIZSCROLL:
  39.             return TRUE;
  40.         default:
  41.             break;
  42.     }
  43.     return BaseWndProc(BUTTON, wnd, msg, p1, p2);
  44. }
  45.  
  46.  
  47.